home *** CD-ROM | disk | FTP | other *** search
/ The World's Largest Collection of Windows Software / The World's Largest Collection of Windows Software - Disc 1.iso / connect / _j2 / wvnsc926 / rcs / wvsckgen.c < prev    next >
C/C++ Source or Header  |  1994-09-21  |  31KB  |  1,608 lines

  1. head    1.19;
  2. access;
  3. symbols;
  4. locks; strict;
  5. comment    @ * @;
  6.  
  7.  
  8. 1.19
  9. date    94.09.22.00.16.59;    author jcooper;    state Exp;
  10. branches;
  11. next    1.18;
  12.  
  13. 1.18
  14. date    94.09.16.01.07.19;    author jcooper;    state Exp;
  15. branches;
  16. next    1.17;
  17.  
  18. 1.17
  19. date    94.08.11.20.16.41;    author rushing;    state Exp;
  20. branches;
  21. next    1.16;
  22.  
  23. 1.16
  24. date    94.08.10.21.27.53;    author rushing;    state Exp;
  25. branches;
  26. next    1.15;
  27.  
  28. 1.15
  29. date    94.08.04.17.59.36;    author rushing;    state Exp;
  30. branches;
  31. next    1.14;
  32.  
  33. 1.14
  34. date    94.08.03.22.16.25;    author dumoulin;    state Exp;
  35. branches;
  36. next    1.13;
  37.  
  38. 1.13
  39. date    94.07.12.22.19.04;    author rushing;    state Exp;
  40. branches;
  41. next    1.12;
  42.  
  43. 1.12
  44. date    94.07.12.21.42.48;    author rushing;    state Exp;
  45. branches;
  46. next    1.11;
  47.  
  48. 1.11
  49. date    94.06.10.01.10.21;    author rushing;    state Exp;
  50. branches;
  51. next    1.10;
  52.  
  53. 1.10
  54. date    94.06.09.21.47.08;    author rushing;    state Exp;
  55. branches;
  56. next    1.9;
  57.  
  58. 1.9
  59. date    94.06.09.18.39.34;    author rushing;    state Exp;
  60. branches;
  61. next    1.8;
  62.  
  63. 1.8
  64. date    94.06.07.01.33.36;    author rushing;    state Exp;
  65. branches;
  66. next    1.7;
  67.  
  68. 1.7
  69. date    94.06.02.00.11.48;    author rushing;    state Exp;
  70. branches;
  71. next    1.6;
  72.  
  73. 1.6
  74. date    94.05.27.01.18.12;    author rushing;    state Exp;
  75. branches;
  76. next    1.5;
  77.  
  78. 1.5
  79. date    94.05.23.19.51.51;    author rushing;    state Exp;
  80. branches;
  81. next    1.4;
  82.  
  83. 1.4
  84. date    94.05.19.02.03.05;    author rushing;    state Exp;
  85. branches;
  86. next    1.3;
  87.  
  88. 1.3
  89. date    94.03.22.22.44.55;    author rushing;    state Exp;
  90. branches;
  91. next    1.2;
  92.  
  93. 1.2
  94. date    94.03.22.20.43.06;    author rushing;    state Exp;
  95. branches;
  96. next    1.1;
  97.  
  98. 1.1
  99. date    94.02.04.02.17.15;    author rushing;    state Exp;
  100. branches;
  101. next    ;
  102.  
  103.  
  104. desc
  105. @generic socket DLL interface
  106. @
  107.  
  108.  
  109. 1.19
  110. log
  111. @forwarding bug fixed
  112. @
  113. text
  114. @/* Interface to GENSOCK module */
  115. /* $Id: wvsckgen.c 1.18 1994/09/16 01:07:19 jcooper Exp $ */
  116.  
  117. #include <windows.h>
  118. #include <windowsx.h>
  119. #include "wvglob.h"
  120. #include "winvn.h"
  121. #pragma hdrstop
  122. #include <stdlib.h>
  123. #include <stdio.h> /* for sprintf */
  124. #include <stdarg.h> /* for varargs stuff */
  125.  
  126. #define MAXSENDLEN 32767
  127. #define COMMBUFSIZE    1600
  128.  
  129. /* generic socket DLL support */
  130. #include "gensock.h"
  131.  
  132. char    CommBuff[COMMBUFSIZE];
  133. int    CommBuffIdx = COMMBUFSIZE + 1;
  134. int    CharsInCommBuff = 0;
  135.  
  136. socktag    NNTPSock;
  137. socktag SMTPSock;
  138. char my_hostname[1024];
  139.  
  140. /* functions the rest of winvn expects to see */
  141. void PutCommLine(char *line);
  142. void PutCommData(char *data, unsigned int length);
  143.  
  144. int MRRReadComm(void);
  145. void MRRCloseComm(void);
  146. int MRRInitComm(void);
  147. int send_smtp_message(char * destination, char * message);
  148. int forward_smtp_message (char * destination, TypDoc * Doc);
  149.  
  150. /* internal to this file */
  151. int close_smtp_socket(void);
  152. int open_smtp_socket(void);
  153. void smtp_error (char * message);
  154. int send_smtp_article (char * destination, TypDoc *Doc);
  155. int send_smtp_edit_data (char * message);
  156. int prepare_smtp_message (char * destination);
  157. int finish_smtp_message (void);
  158. int get_smtp_line (void);
  159. int put_smtp_line (socktag sock, char far * line, unsigned int nchars);
  160. int send_cc_article (char * destination, char * editstr);
  161.  
  162. HINSTANCE    gensock_lib = 0;
  163.  
  164. int (FAR PASCAL *pgensock_connect) (char FAR * hostname, char FAR * service, socktag FAR * pst);
  165. int (FAR PASCAL *pgensock_getchar) (socktag st, int wait, char FAR * ch);
  166. int (FAR PASCAL *pgensock_put_data) (socktag st, char FAR * data, unsigned long length);
  167. int (FAR PASCAL *pgensock_close) (socktag st);
  168. int (FAR PASCAL *pgensock_gethostname) (char FAR * name, int namelen);
  169. int (FAR PASCAL *pgensock_put_data_buffered) (socktag st, char FAR * data, unsigned long length);
  170. int (FAR PASCAL *pgensock_put_data_flush) (socktag st);
  171.  
  172.  
  173. /*-- function MRRReadComm ---------------------------------------
  174.  *
  175.  *  Reads characters from the NNTP Socket
  176.  */
  177.  
  178. #define ERROR_BUFFER_SIZE 1024
  179.  
  180. void
  181. complain (char *fmt, ... )
  182. {
  183.   va_list marker;
  184.   char    message[ERROR_BUFFER_SIZE];
  185.   int done = 0;
  186.  
  187.   /* Write text to a string and output the string. */
  188.   va_start(marker, fmt);
  189.   _vsnprintf(message, ERROR_BUFFER_SIZE, fmt, marker);
  190.   va_end(marker);
  191.   MessageBox (hWndConf, message, "WinVN GenSock Library Error", MB_OK);
  192. }
  193.  
  194. void
  195. gensock_error (char * function, int retval)
  196. {
  197.   char error_string[512];
  198.   int len;
  199.  
  200.   len = LoadString (hInst, retval, error_string, sizeof(error_string));
  201.   complain ("error %d in function '%s', '%s'",
  202.         retval,
  203.         function,
  204.         len == 0 ? "[couldn't get error string]" : error_string);
  205. }
  206.  
  207. int MRRReadComm()
  208. {
  209.   int retval;
  210.   unsigned char ch;
  211.  
  212.   /* we set wait = 1, sortof non-blocking */
  213.   if ((retval = (*pgensock_getchar) (NNTPSock, 1, &ch))) {
  214.     switch (retval) {
  215.     case WAIT_A_BIT:
  216.     case ERR_BUSY:
  217.       break;
  218.     case ERR_NOT_CONNECTED:
  219.       Initializing = INIT_NOT_CONNECTED;
  220.       SendMessage (hWndConf, (UINT) WM_COMMAND,
  221.                (WPARAM) IDM_DISCONNECT, (LPARAM) 0);
  222.       complain ("NNTP server has closed the connection");
  223.       return (-1);
  224.       break;
  225.     default:
  226.       gensock_error ("gensock_getchar", retval);
  227.     }
  228.     return (-1);
  229.   }
  230.   else
  231.     return ((int)ch);
  232. }
  233.  
  234. int
  235. putline_internal (socktag sock, char * line, unsigned int nchars)
  236. {
  237.   int retval;
  238.  
  239.   if ((retval =
  240.        (*pgensock_put_data) (sock,
  241.                 (char FAR *) line,
  242.                 (unsigned long) nchars))) {
  243.     switch (retval) {
  244.     case ERR_NOT_CONNECTED:
  245.       Initializing = INIT_NOT_CONNECTED;
  246.       SendMessage (hWndConf, (UINT) WM_COMMAND,
  247.                (WPARAM) IDM_DISCONNECT, (LPARAM) 0);
  248.       complain ("NNTP server has closed the connection");
  249.       return (-1);
  250.       break;
  251.  
  252.     default:
  253.       gensock_error ("gensock_put_data", retval);
  254.     }
  255.     return (-1);
  256.   }
  257.   return (0);
  258. }
  259.  
  260. /* PutCommLine takes a string, sends it, followed by
  261.  * \r\n.  All one-line sends in winvn should use this.
  262.  */
  263.  
  264. void
  265. PutCommLine (char * line)
  266. {
  267.   putline_internal (NNTPSock, line, lstrlen(line));
  268.   putline_internal (NNTPSock, "\r\n", 2);
  269. }
  270.  
  271. /* Use this function for sending larger chunks of data.
  272.  * the text data from an Edit class window can be sent
  273.  * using this function
  274.  */
  275.  
  276. void
  277. PutCommData (char * data, unsigned int length)
  278. {
  279.   putline_internal (NNTPSock, data, length);
  280. }
  281.  
  282. /*-- function MRRCloseComm -----------------------------------------
  283.  *
  284.  *  Close the communications port, serial or TCP.
  285.  */
  286. void MRRCloseComm ()
  287. {
  288.   (*pgensock_close)(NNTPSock);
  289.   NNTPSock = (socktag) 0;
  290.   FreeLibrary(gensock_lib);
  291.   gensock_lib = 0;
  292. }
  293.  
  294. int
  295. load_gensock()
  296. {
  297.   if ((gensock_lib = LoadLibrary(GenSockDLL)) < HINSTANCE_ERROR) {
  298.     char message[256];
  299.     wsprintf (message, "Couldn't load '%s'", GenSockDLL);
  300.     complain (message);
  301.     gensock_lib = 0;
  302.     return (-1);
  303.   }
  304.  
  305.   if (((FARPROC)pgensock_connect =
  306.        GetProcAddress(gensock_lib, "gensock_connect")) == NULL) {
  307.     complain ("couldn't getprocaddress for gensock_connect");
  308.     return (-1);
  309.   }
  310.  
  311.   if (((FARPROC)pgensock_getchar =
  312.        GetProcAddress(gensock_lib, "gensock_getchar")) == NULL) {
  313.     complain ("couldn't getprocaddress for gensock_getchar");
  314.     return (-1);
  315.   }
  316.  
  317.   if (((FARPROC)pgensock_put_data =
  318.        GetProcAddress(gensock_lib, "gensock_put_data")) == NULL) {
  319.     complain ("couldn't getprocaddress for gensock_put_data");
  320.     return (-1);
  321.   }
  322.  
  323.   if (((FARPROC)pgensock_close =
  324.        GetProcAddress(gensock_lib, "gensock_close")) == NULL) {
  325.     complain ("couldn't getprocaddress for gensock_close");
  326.     return (-1);
  327.   }
  328.  
  329.   if (((FARPROC)pgensock_gethostname =
  330.        GetProcAddress(gensock_lib, "gensock_gethostname")) == NULL) {
  331.     complain ("couldn't getprocaddress for gensock_gethostname");
  332.     return (-1);
  333.   }
  334.  
  335.   if (((FARPROC)pgensock_put_data_buffered =
  336.        GetProcAddress(gensock_lib, "gensock_put_data_buffered")) == NULL) {
  337.     complain ("couldn't getprocaddress for gensock_put_data_buffered");
  338.     return (-1);
  339.   }
  340.  
  341.   if (((FARPROC)pgensock_put_data_flush =
  342.        GetProcAddress(gensock_lib, "gensock_put_data_flush")) == NULL) {
  343.     complain ("couldn't getprocaddress for gensock_put_data_flush");
  344.     return (-1);
  345.   }
  346.  
  347.   return (0);
  348. }
  349.  
  350.  
  351. int
  352. MRRInitComm()
  353. {
  354.   int retval;
  355.  
  356.   /* load the library if it's not loaded */
  357.   if (!gensock_lib) {
  358.     if ((retval = load_gensock())) {
  359.       return (retval);
  360.     }
  361.   }
  362.  
  363.   /* to keep our sanity, we will quietly try '119' in case it fails */
  364.   if ((retval = (*pgensock_connect) ((LPSTR)NNTPHost,
  365.                      (LPSTR)NNTPService,
  366.                      &NNTPSock))) {
  367.     if (retval == ERR_CANT_RESOLVE_SERVICE) {
  368.       if ((retval = (*pgensock_connect) ((LPSTR)NNTPHost,
  369.                      (LPSTR)"119",
  370.                      &NNTPSock))) {
  371.     gensock_error ("gensock_connect", retval);
  372.     return (-1);
  373.       }
  374.     }
  375.     /* error other than can't resolve service */
  376.     else {
  377.       gensock_error ("gensock_connect", retval);
  378.       return (-1);
  379.     }
  380.   }
  381.  
  382.   IgnoreCommCh = '\r';
  383.   EOLCommCh = '\n';
  384.  
  385.   CommLinePtr = CommLineIn;
  386.   CommState = ST_ESTABLISH_COMM;
  387.   CommBusy = FALSE;
  388.   return (0);
  389. }
  390.  
  391. /* ---------------------------------------------------------------------------
  392.  * transform_and_send_edit_data
  393.  */
  394.  
  395. int transform_and_send_edit_data (socktag sock, char * editptr)
  396. {
  397.   char *index;
  398.   char *header_end;
  399.   char previous_char = 'x';
  400.   unsigned int send_len;
  401.   int retval;
  402.   BOOL done = 0;
  403.  
  404.   send_len = lstrlen(editptr);
  405.   index = editptr;
  406.  
  407.   header_end = strstr (editptr, "\r\n\r\n");
  408.  
  409.   while (!done) {
  410.     /* room for extra char for double dot on end case */
  411.     while ((unsigned int) (index - editptr) < send_len) {
  412.       switch (*index) {
  413.       case '.':
  414.     if (previous_char == '\n') {
  415.       /* send _two_ dots... */
  416.       if ((retval = (*pgensock_put_data_buffered) (sock, index, 1))) {
  417.         return (retval);
  418.       }
  419.     }
  420.     if ((retval = (*pgensock_put_data_buffered) (sock, index, 1))) {
  421.       return (retval);
  422.     }
  423.     break;
  424.       case '\r':
  425.     /* watch for soft-breaks in the header, and ignore them */
  426.  
  427.     if (index < header_end && (strncmp (index, "\r\r\n", 3) == 0)) {
  428.       index = index + 2;
  429.       break;
  430.     }
  431.     else {
  432.       if (previous_char != '\r') {
  433.         if ((retval = (*pgensock_put_data_buffered) (sock, index, 1))) {
  434.           return (retval);
  435.         }
  436.       }
  437.       /* soft line-break (see EM_FMTLINES), skip extra CR */
  438.       break;
  439.     }
  440.  
  441.       default:
  442.     if ((retval = (*pgensock_put_data_buffered) (sock, index, 1))) {
  443.       return (retval);
  444.     }
  445.       }
  446.     previous_char = *index;
  447.     index++;
  448.     }
  449.     if ( (unsigned int) (index - editptr) == send_len) {
  450.       done = 1;
  451.     }
  452.   }
  453.  
  454.   /* this handles the case where the user doesn't end the last
  455.    * line with a <return>
  456.    */
  457.  
  458.   if (editptr[send_len-1] != '\n') {
  459.     if ((retval = (*pgensock_put_data_buffered) (sock, "\r\n.\r\n", 5))) {
  460.       return (retval);
  461.     }
  462.   }
  463.   else {
  464.     if ((retval = (*pgensock_put_data_buffered) (sock, ".\r\n", 3))) {
  465.       return (retval);
  466.     }
  467.   }
  468.  
  469.   /* now make sure it's all sent... */
  470.   if ((retval = (*pgensock_put_data_flush)(sock))) {
  471.     return (retval);
  472.   }
  473.   return (TRUE);
  474. }
  475.  
  476. int
  477. post_edit_data (char * edit_data)
  478. {
  479.   return (transform_and_send_edit_data (NNTPSock, edit_data));
  480. }
  481.  
  482. int open_smtp_socket ()
  483. {
  484.   int retval;
  485.  
  486.  
  487.   /* load the library if it's not loaded */
  488.   if (!gensock_lib) {
  489.     if ((retval = load_gensock())) {
  490.       return (retval);
  491.     }
  492.   }
  493.  
  494.   if ((retval = (*pgensock_connect) ((LPSTR)SMTPHost,
  495.                      (LPSTR)"smtp",
  496.                      &SMTPSock))) {
  497.     if (retval == ERR_CANT_RESOLVE_SERVICE) {
  498.       if ((retval = (*pgensock_connect) ((LPSTR)SMTPHost,
  499.                      (LPSTR)"25",
  500.                      &SMTPSock))) {
  501.     gensock_error ("gensock_connect", retval);
  502.     return (-1);
  503.       }
  504.     }
  505.     /* error other than can't resolve service */
  506.     else {
  507.       gensock_error ("gensock_connect", retval);
  508.       return (-1);
  509.     }
  510.   }
  511.  
  512.   /* we wait to do this until here because WINSOCK is
  513.    * guaranteed to be already initialized at this point.
  514.    */
  515.  
  516.   /* get the local hostname (needed by SMTP) */
  517.   if ((retval = (*pgensock_gethostname) (my_hostname, sizeof(my_hostname)))) {
  518.     gensock_error ("gensock_gethostname", retval);
  519.     return (-1);
  520.   }
  521.  
  522. }
  523.  
  524. int close_smtp_socket()
  525. {
  526.   int retval;
  527.  
  528.   if ((retval = (*pgensock_close) (SMTPSock))) {
  529.     gensock_error ("gensock_close", retval);
  530.     return (-1);
  531.   }
  532.  
  533.   /* in case we're _not_ connected to a NNTP server, and
  534.    * we just used SMTP mail only, then we probably want to
  535.    * close the library...
  536.    */
  537.  
  538.   if (!NNTPSock) {
  539.     FreeLibrary(gensock_lib);
  540.     gensock_lib = 0;
  541.   }
  542.  
  543.   return (0);
  544. }
  545.  
  546. /* 'destination' is the address the message is to be sent to */
  547. /* 'message' is a pointer to a null-terminated 'string' containing the */
  548. /* entire text of the message. */
  549.  
  550. int prepare_smtp_message(char * destination)
  551. {
  552.   char out_data[MAXOUTLINE];
  553.   char *ptr;
  554.   int len, startLen;
  555.  
  556.   if (open_smtp_socket())
  557.     return (-1);
  558.  
  559.   if (get_smtp_line() != 220) {
  560.     smtp_error ("SMTP server error");
  561.     return(-1);
  562.   }
  563.  
  564.   sprintf (out_data, "HELO %s\r\n", my_hostname);
  565.   put_smtp_line (SMTPSock, out_data, strlen (out_data));
  566.  
  567.   if (get_smtp_line() != 250) {
  568.     smtp_error ("SMTP server error");
  569.     return (-1);
  570.   }
  571.  
  572.   sprintf (out_data, "MAIL From:<%s>\r\n", MailAddress);
  573.   put_smtp_line (SMTPSock, out_data, strlen (out_data));
  574.  
  575.   if (get_smtp_line() != 250) {
  576.     smtp_error ("The mail server doesn't like the sender name, "
  577.         "have you set your mail address correctly?");
  578.     return (-1);
  579.   }
  580.  
  581.   // do a series of RCPT lines for each name in address line
  582.   for (ptr = destination; *ptr; ptr += len + 1)
  583.   {
  584.     // if there's only one token left, then len will = startLen,
  585.     // and we'll iterate once only
  586.     startLen = strlen (ptr);
  587.     if ((len = strcspn (ptr, " ,\n\t\r")) != startLen)
  588.     {
  589.       ptr[len] = '\0';            // replace delim with NULL char
  590.       while (strchr (" ,\n\t\r", ptr[len+1]))    // eat white space
  591.         ptr[len++] = '\0';
  592.     }
  593.  
  594.     sprintf (out_data, "RCPT To: <%s>\r\n", ptr);
  595.     putline_internal (SMTPSock, out_data, strlen (out_data));
  596.  
  597.     if (get_smtp_line() != 250)
  598.     {
  599.       sprintf (str, "The mail server doesn't like the name %s.  "
  600.                     "Have you set the 'To: ' field correctly?", ptr);
  601.       smtp_error (str);
  602.       return (-1);
  603.     }
  604.  
  605.     if (len == startLen)    // last token, we're done
  606.       break;
  607.   }
  608.  
  609.   sprintf (out_data, "DATA\r\n");
  610.   put_smtp_line (SMTPSock, out_data, strlen (out_data));
  611.  
  612.   if (get_smtp_line() != 354) {
  613.     smtp_error ("Mail server error accepting message data");
  614.     return (-1);
  615.   }
  616.  
  617.   return(0);
  618.  
  619. }
  620.  
  621. int send_smtp_edit_data (char * message)
  622. {
  623.   transform_and_send_edit_data (SMTPSock, message);
  624.  
  625.   if (get_smtp_line() != 250) {
  626.     smtp_error ("Message not accepted by server");
  627.     return (-1);
  628.   }
  629.   return(0);
  630. }
  631.  
  632. int
  633. finish_smtp_message () {
  634.   return (put_smtp_line (SMTPSock, "QUIT\r\n", 6));
  635. }
  636.  
  637. int get_smtp_line ()
  638. {
  639.   char ch = '.';
  640.   char in_data [MAXOUTLINE];
  641.   char * index;
  642.   int retval = 0;
  643.  
  644.   index = in_data;
  645.  
  646.   while (ch != '\n') {
  647.     if ((retval = (*pgensock_getchar) (SMTPSock, 0, &ch))) {
  648.       gensock_error ("gensock_getchar", retval);
  649.       return (-1);
  650.     }
  651.     else {
  652.       *index = ch;
  653.       index++;
  654.     }
  655.   }
  656.  
  657.   /* this is to support multi-line responses, common with */
  658.   /* servers that speak ESMTP */
  659.  
  660.   /* I know, I know, it's a hack 8^) */
  661.   if (in_data[3] == '-')
  662.     return (get_smtp_line());
  663.   else
  664.     return (atoi(in_data));
  665. }
  666.  
  667. int put_smtp_line (socktag sock, char far * line, unsigned int nchars)
  668. {
  669.   int retval;
  670.  
  671.   if ((retval = (*pgensock_put_data) (sock, line, (unsigned long) nchars))) {
  672.     gensock_error ("gensock_put_data", retval);
  673.     return (-1);
  674.   }
  675.   return (0);
  676. }
  677.  
  678. void smtp_error (char * message)
  679. {
  680.   MessageBox (hWndConf, message, "WinVN", MB_OK);
  681.   put_smtp_line (SMTPSock, "QUIT\r\n", 6);
  682.   close_smtp_socket();
  683. }
  684.  
  685.  
  686. int send_smtp_message (char * destination, char * message)
  687. {
  688.   if (!prepare_smtp_message (destination))
  689.     if (!send_smtp_edit_data (message))
  690.       if (!finish_smtp_message ()) {
  691.     close_smtp_socket();
  692.     return (0);
  693.       }
  694.  
  695.   close_smtp_socket();
  696.   return (1);
  697. }
  698.  
  699. int forward_smtp_message (char * destination, TypDoc * Doc)
  700. {
  701.   int retval;
  702.  
  703.   if ((retval = prepare_smtp_message (destination))) {
  704.     complain ("prepare_smtp_message returned %d\r\n", retval);
  705.     return (retval);
  706.   }
  707.   else if ((retval = send_smtp_article (destination, Doc))) {
  708.     complain ("send_smtp_article returned %d\r\n", retval);
  709.     return (retval);
  710.   }
  711.   else if ((retval = finish_smtp_message())) {
  712.     complain ("finish_smtp_message() returned %d\r\n", retval);
  713.     close_smtp_socket();
  714.     return (retval);
  715.   }
  716.   close_smtp_socket();
  717.   return (1);
  718. }
  719.  
  720. // testing new buffered stuff...
  721.  
  722. int send_smtp_article (char * destination, TypDoc * Doc)
  723. {
  724.   HANDLE hBlock;
  725.   unsigned int Offset;
  726.   TypLineID MyLineID;
  727.   TypBlock far *BlockPtr;
  728.   TypLine far *LinePtr;
  729.   int retval;
  730.   char line [MAXOUTLINE], temp [MAXOUTLINE];
  731.  
  732.   _snprintf(line,
  733.         MAXOUTLINE,
  734.         "From: %s (%s)\r\n",
  735.         MailAddress,
  736.         UserName);
  737.  
  738.  
  739.   if ((retval =
  740.        (*pgensock_put_data_buffered) (SMTPSock, line, lstrlen(line)))) {
  741.     return (retval);
  742.   }
  743.  
  744.   _snprintf(line,
  745.         MAXOUTLINE,
  746.         "To: %s\r\n",
  747.         destination);
  748.  
  749.  
  750.   if ((retval =
  751.        (*pgensock_put_data_buffered) (SMTPSock, line, lstrlen(line)))) {
  752.     return (retval);
  753.   }
  754.  
  755.   /* find the subject line */
  756.   TopOfDoc (Doc, &BlockPtr, &LinePtr);
  757.   *line = '\0';
  758.   while (ExtractTextLine (Doc, LinePtr, temp, MAXOUTLINE - 1))
  759.     {
  760.     if (!_strnicmp(temp, "subject:", 8))
  761.       {
  762.         _snprintf(line,
  763.              MAXOUTLINE,
  764.          "Subject: %s (fwd)\r\n", 
  765.          &temp[8]);
  766.         break;
  767.       }
  768.       if (!NextLine (&BlockPtr, &LinePtr))
  769.        break;
  770.     }
  771.   if (*line && (retval =
  772.        (*pgensock_put_data_buffered) (SMTPSock, line, lstrlen(line)))) {
  773.     return (retval);
  774.   }
  775.   
  776.   _snprintf(line,
  777.         MAXOUTLINE,
  778.         "\r\n[article forwarded from %s (%s)]\r\n\r\n",
  779.         UserName,
  780.         MailAddress);
  781.  
  782.   if ((retval =
  783.        (*pgensock_put_data_buffered) (SMTPSock, line, lstrlen(line)))) {
  784.     return (retval);
  785.   }
  786.  
  787.   TopOfDoc (Doc, &BlockPtr, &LinePtr);
  788.   while (ExtractTextLine (Doc, LinePtr, line, MAXOUTLINE - 1))
  789.     {
  790.       /* double a leading dot */
  791.       if (line[0] == '.') {
  792.     if ((retval = (*pgensock_put_data_buffered) (SMTPSock, ".", 1))) {
  793.       return (retval);
  794.     }
  795.       }
  796.       strcat (line, "\r\n");
  797.  
  798.       if ((retval =
  799.        (*pgensock_put_data_buffered) (SMTPSock, line, strlen(line)))) {
  800.     return (retval);
  801.       }
  802.  
  803.       if (!NextLine (&BlockPtr, &LinePtr))
  804.     break;
  805.     }
  806.   UnlockLine (BlockPtr, LinePtr, &hBlock, &Offset, &MyLineID);
  807.  
  808.   if ((retval =
  809.        (*pgensock_put_data_buffered) (SMTPSock, "\r\n.\r\n", 5))) {
  810.     return (retval);
  811.   }
  812.   if ((retval =
  813.        (*pgensock_put_data_flush) (SMTPSock))) {
  814.     return (retval);
  815.   }
  816.  
  817.   if ((retval = get_smtp_line()) != 250) {
  818.     complain("Send Failed. get_smtp_line() returned %d\r\n", retval);
  819.   }
  820.  
  821.  return (0);
  822. }
  823.  
  824.  
  825. int cc_smtp_message (char * destination, char * editstr)
  826. {
  827.   int retval;
  828.  
  829.   if ((retval = prepare_smtp_message (destination))) {
  830.     complain ("prepare_smtp_message returned %d\r\n", retval);
  831.     return (retval);
  832.   }
  833.   else if ((retval = send_cc_article (destination, editstr))) {
  834.     complain ("send_cc_article returned %d\r\n", retval);
  835.     return (retval);
  836.   }
  837.   else if ((retval = finish_smtp_message())) {
  838.     complain ("finish_smtp_message() returned %d\r\n", retval);
  839.     close_smtp_socket();
  840.     return (retval);
  841.   }
  842.   close_smtp_socket();
  843.   return (1);
  844. }
  845.  
  846. int send_cc_article (char * destination, char * editstr)
  847. {
  848.   char line [MAXOUTLINE];
  849.   int retval;
  850.   
  851.   _snprintf(line,
  852.         MAXOUTLINE,
  853.         "To: %s\r\n",
  854.         destination);
  855.  
  856.   if ((retval =
  857.       (*pgensock_put_data_buffered) (SMTPSock, line, lstrlen(line)))) {
  858.     return (retval);
  859.   }
  860.  
  861.   if ((retval =
  862.       send_smtp_edit_data (editstr))) {
  863.     return (retval);
  864.   }
  865.  
  866.  return (0);
  867. }
  868.  
  869. @
  870.  
  871.  
  872. 1.18
  873. log
  874. @New code for cc-by-mail.  new forward-article subject line handler.
  875. general cleanup for 92.6
  876. @
  877. text
  878. @d2 1
  879. a2 1
  880. /* $Id: wvsckgen.c 1.17 1994/08/11 20:16:41 rushing Exp $ */
  881. d644 1
  882. d653 1
  883. a653 1
  884.     break;
  885. d655 2
  886. d658 1
  887. a658 1
  888.   if ((retval =
  889. @
  890.  
  891.  
  892. 1.17
  893. log
  894. @better handling of nntp disconnect
  895. @
  896. text
  897. @d2 1
  898. a2 1
  899. /* $Id: wvsckgen.c 1.16 1994/08/10 21:27:53 rushing Exp rushing $ */
  900. d5 1
  901. d8 1
  902. d47 1
  903. d49 1
  904. a49 1
  905. HANDLE    gensock_lib = 0;
  906. d184 1
  907. a184 1
  908.   if ((gensock_lib = LoadLibrary(GenSockDLL)) < 32) {
  909. d617 1
  910. a617 1
  911.   char line [MAXOUTLINE];
  912. d642 13
  913. a654 5
  914.   _snprintf(line,
  915.         MAXOUTLINE,
  916.         "Subject: forwarded Usenet article\r\n",
  917.         destination);
  918.  
  919. d659 1
  920. a659 1
  921.  
  922. d703 45
  923. @
  924.  
  925.  
  926. 1.16
  927. log
  928. @don't ingore NNTPService
  929. @
  930. text
  931. @d2 1
  932. a2 1
  933. /* $Id: wvsckgen.c 1.15 1994/08/04 17:59:36 rushing Exp $ */
  934. a102 1
  935.       MRRCloseComm();
  936. d104 2
  937. a105 2
  938.       CommState = ST_CLOSED_COMM;
  939.       InvalidateRect (hWndConf, NULL, TRUE);
  940. a128 1
  941.       MRRCloseComm();
  942. d130 2
  943. a131 2
  944.       CommState = ST_CLOSED_COMM;
  945.       InvalidateRect (hWndConf, NULL, TRUE);
  946. d133 1
  947. @
  948.  
  949.  
  950. 1.15
  951. log
  952. @removed debug thing that got left in
  953. @
  954. text
  955. @d2 1
  956. a2 1
  957. /* $Id: wvsckgen.c 1.14 1994/08/03 22:16:25 dumoulin Exp rushing $ */
  958. d248 1
  959. d250 1
  960. a250 1
  961.                      (LPSTR)"nntp",
  962. @
  963.  
  964.  
  965. 1.14
  966. log
  967. @Fixed compiler warning messages
  968. @
  969. text
  970. @d2 1
  971. a2 1
  972. /* $Id: wvsckgen.c 1.13 1994/07/12 22:19:04 rushing Exp dumoulin $ */
  973. d690 3
  974. a692 1
  975.   complain("get_smtp_line returned %d\r\n", get_smtp_line());
  976. @
  977.  
  978.  
  979. 1.13
  980. log
  981. @ignore soft breaks in headers when sending...
  982. @
  983. text
  984. @d2 1
  985. a2 1
  986. /* $Id: wvsckgen.c 1.12 1994/07/12 21:42:48 rushing Exp $ */
  987. d295 1
  988. a295 1
  989.     while ((index - editptr) < send_len) {
  990. d333 1
  991. a333 1
  992.     if ((index - editptr) == send_len) {
  993. @
  994.  
  995.  
  996. 1.12
  997. log
  998. @changed transform_... to use new buffered gensock put_data
  999. and other gensock cleanup.
  1000. @
  1001. text
  1002. @d2 1
  1003. a2 1
  1004. /* $Id: wvsckgen.c 1.10 1994/06/09 21:47:08 rushing Exp $ */
  1005. a141 1
  1006.   
  1007. a278 2
  1008. /* this needs to be rewritten to use put_data_buffered... */
  1009.  
  1010. d282 1
  1011. d291 2
  1012. d309 11
  1013. a319 3
  1014.     if (previous_char != '\r') {
  1015.       if ((retval = (*pgensock_put_data_buffered) (sock, index, 1))) {
  1016.         return (retval);
  1017. d321 2
  1018. d324 1
  1019. a324 2
  1020.     /* soft line-break (see EM_FMTLINES), skip extra CR */
  1021.     break;
  1022. d596 1
  1023. a596 1
  1024.     complain ("finish_smtp_message() returned %d\r\n", retval);    
  1025. @
  1026.  
  1027.  
  1028. 1.11
  1029. log
  1030. @bad return value in send_smtp_article
  1031. @
  1032. text
  1033. @d2 1
  1034. a2 1
  1035. /* $Id: wvsckgen.c 1.10 1994/06/09 21:47:08 rushing Exp rushing $ */
  1036. d39 1
  1037. a39 1
  1038. int send_smtp_article (TypDoc *Doc);
  1039. d53 2
  1040. d56 1
  1041. d107 1
  1042. d128 12
  1043. a139 1
  1044.     gensock_error ("gensock_put_data", retval);
  1045. d142 2
  1046. a143 3
  1047.   else
  1048.     return (0);
  1049.  
  1050. a182 2
  1051.   int retval;
  1052.  
  1053. d220 13
  1054. a233 1
  1055.  
  1056. d280 1
  1057. a280 1
  1058. #define MAGIC_BUFFER_SIZE    512
  1059. d287 1
  1060. a288 2
  1061.   unsigned int magic_index = 0;
  1062.   char magic_buffer[MAGIC_BUFFER_SIZE];
  1063. a293 1
  1064.     magic_index = 0;
  1065. d295 1
  1066. a295 1
  1067.     while (((index - editptr) < send_len) && (magic_index < MAGIC_BUFFER_SIZE - 1))  {
  1068. d300 3
  1069. a302 1
  1070.       magic_buffer[magic_index++] = '.';
  1071. d304 3
  1072. a306 1
  1073.     magic_buffer[magic_index++] = '.';
  1074. d310 3
  1075. a312 1
  1076.       magic_buffer[magic_index++] = '\r';
  1077. d317 3
  1078. a319 1
  1079.     magic_buffer[magic_index++] = *index;
  1080. a323 1
  1081.     putline_internal (sock, magic_buffer, magic_index);
  1082. d334 3
  1083. a336 1
  1084.     putline_internal (sock, "\r\n.\r\n", 5);
  1085. d339 3
  1086. a341 1
  1087.     putline_internal (sock, ".\r\n", 3);
  1088. d344 4
  1089. d417 1
  1090. a417 1
  1091.   
  1092. a426 1
  1093.  
  1094. a429 1
  1095.   int retval;
  1096. d576 15
  1097. a590 6
  1098.   if (!prepare_smtp_message (destination))
  1099.     if (!send_smtp_article (Doc))
  1100.       if (!finish_smtp_message ()) {
  1101.     close_smtp_socket();
  1102.     return (0);
  1103.       }
  1104. d595 3
  1105. a597 1
  1106. int send_smtp_article (TypDoc * Doc)
  1107. d604 1
  1108. d607 38
  1109. a644 1
  1110.   wsprintf(line, "\r\n[article forwarded from %s (%s)]\r\n", UserName, MailAddress);
  1111. d646 4
  1112. a649 2
  1113.   /* blank line to separate the header */
  1114.   put_smtp_line (SMTPSock, line, lstrlen(line));
  1115. d655 5
  1116. a659 2
  1117.       if (line[0] == '.')
  1118.     put_smtp_line (SMTPSock, ".", 1);
  1119. d661 6
  1120. a666 1
  1121.       put_smtp_line (SMTPSock, line, strlen (line));
  1122. d672 10
  1123. a681 1
  1124.   put_smtp_line (SMTPSock, "\r\n.\r\n", 5);
  1125. d683 1
  1126. a683 1
  1127.   return (0);
  1128. @
  1129.  
  1130.  
  1131. 1.10
  1132. log
  1133. @handle unexpected disconnect, and smtp mail while disconnected from nntp
  1134. @
  1135. text
  1136. @d2 1
  1137. a2 1
  1138. /* $Id: wvsckgen.c 1.9 1994/06/09 18:39:34 rushing Exp $ */
  1139. d580 1
  1140. a580 1
  1141.   return (1);
  1142. @
  1143.  
  1144.  
  1145. 1.9
  1146. log
  1147. @word-wrap, dot-doubling, and default port numbers
  1148. @
  1149. text
  1150. @d2 1
  1151. a2 1
  1152. /* $Id: wvsckgen.c 1.8 1994/06/07 01:33:36 rushing Exp rushing $ */
  1153. d46 1
  1154. a46 1
  1155. HANDLE    gensock_lib;
  1156. d59 1
  1157. a59 1
  1158. #define ERROR_BUFFER_SIZE 1204
  1159. d80 1
  1160. a80 1
  1161.   
  1162. d99 7
  1163. d161 1
  1164. d163 1
  1165. d167 1
  1166. a167 1
  1167. MRRInitComm()
  1168. d175 1
  1169. d179 2
  1170. a180 1
  1171.   if (((FARPROC)pgensock_connect = GetProcAddress(gensock_lib, "gensock_connect")) == NULL) {
  1172. d185 2
  1173. a186 1
  1174.   if (((FARPROC)pgensock_getchar = GetProcAddress(gensock_lib, "gensock_getchar")) == NULL) {
  1175. d191 2
  1176. a192 1
  1177.   if (((FARPROC)pgensock_put_data = GetProcAddress(gensock_lib, "gensock_put_data")) == NULL) {
  1178. d197 2
  1179. a198 1
  1180.   if (((FARPROC)pgensock_close = GetProcAddress(gensock_lib, "gensock_close")) == NULL) {
  1181. d203 2
  1182. a204 1
  1183.   if (((FARPROC)pgensock_gethostname = GetProcAddress(gensock_lib, "gensock_gethostname")) == NULL) {
  1184. d208 4
  1185. d213 4
  1186. d218 7
  1187. a241 3
  1188.   else { /* no error originally */
  1189.     return (0);
  1190.   }
  1191. d299 1
  1192. a299 1
  1193.   
  1194. d324 8
  1195. d349 9
  1196. a357 2
  1197.   else { /* no error originally */
  1198.     return (0);
  1199. d359 1
  1200. d370 11
  1201. d395 1
  1202. a395 7
  1203.   
  1204.   /* get the local hostname (needed by SMTP) */
  1205.   if ((retval = (*pgensock_gethostname) (my_hostname, sizeof(my_hostname)))) {
  1206.     gensock_error ("gensock_gethostname", retval);
  1207.     return (-1);
  1208.   }
  1209.   
  1210. d413 1
  1211. a413 1
  1212.   put_smtp_line (SMTPSock, out_data, strlen (out_data));  
  1213. d423 2
  1214. a424 2
  1215.   {                                         
  1216.     // if there's only one token left, then len will = startLen, 
  1217. d428 1
  1218. a428 1
  1219.     { 
  1220. d450 2
  1221. a451 2
  1222.   put_smtp_line (SMTPSock, out_data, strlen (out_data));  
  1223.   
  1224. d464 1
  1225. a464 1
  1226.   
  1227. d483 1
  1228. a483 1
  1229.     
  1230. d496 1
  1231. a496 1
  1232.   
  1233. d503 1
  1234. a503 1
  1235.   else 
  1236. d510 1
  1237. a510 1
  1238.   
  1239. d528 1
  1240. a528 1
  1241.   if (!prepare_smtp_message (destination)) 
  1242. d538 1
  1243. a538 1
  1244.   
  1245. d559 1
  1246. a559 1
  1247.   
  1248. d579 1
  1249. a579 1
  1250.   
  1251. @
  1252.  
  1253.  
  1254. 1.8
  1255. log
  1256. @use new gethostname feature of gensock,
  1257. fixed smtp mail with it
  1258. @
  1259. text
  1260. @d2 1
  1261. a2 1
  1262. /* $Id: wvsckgen.c 1.7 1994/06/02 00:11:48 rushing Exp rushing $ */
  1263. d194 20
  1264. a213 5
  1265.   if ((retval = (*pgensock_connect)((LPSTR)NNTPHost,
  1266.                     (LPSTR)NNTPService,
  1267.                     &NNTPSock))) { 
  1268.     gensock_error ("gensock_connect", retval);
  1269.     return (-1);
  1270. d215 1
  1271. a215 1
  1272.   
  1273. d225 68
  1274. d298 18
  1275. a315 4
  1276.                     (LPSTR)"smtp",
  1277.                     &SMTPSock))) {
  1278.     gensock_error ("gensock_connect", retval);
  1279.     return (-1);
  1280. a316 1
  1281.   return (0);
  1282. d415 2
  1283. a416 16
  1284.   int maillen = strlen(message);
  1285.   int finished = 0;
  1286.  
  1287.   /* as per the comments in wvpost.c, the Edit controls already
  1288.    * have their data in netascii format.
  1289.    */
  1290.  
  1291.   putline_internal(SMTPSock, message, maillen);
  1292.  
  1293.   if (message[maillen] != '\n') {
  1294.     put_smtp_line (SMTPSock, "\r\n.\r\n", 5);
  1295.   }
  1296.   else {
  1297.     put_smtp_line (SMTPSock, ".\r\n", 3);
  1298.   }
  1299.  
  1300. @
  1301.  
  1302.  
  1303. 1.7
  1304. log
  1305. @better error messages
  1306. @
  1307. text
  1308. @d2 1
  1309. a2 1
  1310. /* $Id: wvsckgen.c 1.6 1994/05/27 01:18:12 rushing Exp rushing $ */
  1311. d23 1
  1312. d52 1
  1313. d189 5
  1314. d244 7
  1315. d260 1
  1316. a260 1
  1317.   sprintf (out_data, "HELO\r\n");
  1318. d319 1
  1319. a319 1
  1320.  
  1321. d326 8
  1322. a333 1
  1323.   putline_internal(SMTPSock, message, strlen(message));
  1324. a334 1
  1325.   put_smtp_line (SMTPSock, "\r\n.\r\n", 5);
  1326. @
  1327.  
  1328.  
  1329. 1.6
  1330. log
  1331. @cleaned up smtp some
  1332. @
  1333. text
  1334. @d2 1
  1335. a2 1
  1336. /* $Id: wvsckgen.c 1.5 1994/05/23 19:51:51 rushing Exp rushing $ */
  1337. d8 2
  1338. a9 1
  1339. #include <stdio.h> // for sprintf
  1340. d57 2
  1341. d60 1
  1342. a60 1
  1343. complain(char * message)
  1344. d62 10
  1345. d73 11
  1346. a83 2
  1347. /*  OutputDebugString (message); */
  1348.   MessageBox (hWndConf, message, "WinVN socket error", MB_OK);
  1349. a93 1
  1350.       char message[200];
  1351. d98 1
  1352. a98 2
  1353.       wsprintf (message, "gensock_getchar returns %d\n", retval);
  1354.       complain(message);
  1355. d110 1
  1356. a110 1
  1357.   
  1358. d115 1
  1359. a115 1
  1360.     complain ("Error in gensock_put_data()");
  1361. d188 3
  1362. a190 5
  1363.                    (LPSTR)NNTPService,
  1364.                    &NNTPSock))) { 
  1365.     char message[512];
  1366.     wsprintf (message, "gensock_connect() failed for %s with error code %d\n", NNTPHost, retval);
  1367.     complain (message);
  1368. d206 1
  1369. a206 2
  1370.   char error_message[MAXOUTLINE];
  1371.   
  1372. d210 1
  1373. a210 3
  1374.     wsprintf(error_message, "connect() failed for host '%s', error %d\n",
  1375.                 SMTPHost, retval);
  1376.     complain (error_message);
  1377. a212 1
  1378.  
  1379. d221 1
  1380. a221 1
  1381.     complain ("gensock_close failed() on SMTPSock");
  1382. d338 1
  1383. a338 1
  1384.       complain ("error in gensock_getchar on SMTPSock");
  1385. d362 1
  1386. a362 1
  1387.     complain ("error in gensock_put_data on SMTPSock");
  1388. @
  1389.  
  1390.  
  1391. 1.5
  1392. log
  1393. @NNTPPort becomes NNTPService, and it's a string.
  1394. @
  1395. text
  1396. @d2 1
  1397. a2 1
  1398. /* $Id: $ */
  1399. d169 4
  1400. a172 2
  1401.                    &NNTPSock))) {
  1402.     complain ("gensock_connect() failed for NNTPHost");
  1403. d188 1
  1404. d193 3
  1405. a195 1
  1406.     complain ("gensock_connect() failed for SMTPHost");
  1407. d199 1
  1408. a199 3
  1409.   get_smtp_line();
  1410.  
  1411.   return (1);
  1412. a201 2
  1413.  
  1414. // old boolean ways of mine
  1415. d208 1
  1416. a208 1
  1417.     return (0);
  1418. d210 1
  1419. a210 1
  1420.   return (1);
  1421. d224 7
  1422. a230 2
  1423.   if (!open_smtp_socket())
  1424.     return (0);
  1425. d237 1
  1426. a237 1
  1427.     return (0);
  1428. d246 1
  1429. a246 1
  1430.     return (0);
  1431. d270 1
  1432. a270 1
  1433.       return (0);
  1434. d282 1
  1435. a282 1
  1436.     return (0);
  1437. d285 1
  1438. a285 1
  1439.   return(1);
  1440. a292 1
  1441.   char out_data[MAXOUTLINE];
  1442. a297 31
  1443. #if 0
  1444.   /* this code is a slight rework of that from wvpost.c */
  1445.   while (!finished)
  1446.     {
  1447.       int linelen;
  1448.       char * outptr;
  1449.  
  1450.       for (linelen = 0, outptr = out_data;
  1451.        *message && *message != '\r' && linelen < MAXOUTLINE;
  1452.        linelen++)
  1453.     {            /* special case of a line starting with '.' */
  1454.       if ((outptr == out_data) && (*message == '.'))
  1455.         *(outptr++) = '.';
  1456.       else
  1457.         *(outptr++) = *(message++);
  1458.     }
  1459.       
  1460.       *(outptr++) = '\r'; *(outptr++) = '\n';
  1461.       linelen += 2;
  1462.       
  1463.       put_smtp_line (SMTPSock, out_data, linelen);
  1464.  
  1465.       if (*message == '\r')
  1466.     message++;
  1467.       if (*message == '\n')
  1468.     message++;
  1469.       if (!*message)
  1470.       finished = TRUE;
  1471.     }
  1472. #endif
  1473.  
  1474. d303 1
  1475. a303 1
  1476.     return (0);
  1477. d305 1
  1478. a305 1
  1479.   return(1);
  1480. d308 1
  1481. d310 1
  1482. a310 4
  1483.  
  1484.   put_smtp_line (SMTPSock, "QUIT\r\n", 6);
  1485.   close_smtp_socket();
  1486.   return (1);
  1487. a312 1
  1488.  
  1489. d325 1
  1490. d333 8
  1491. a340 1
  1492.   return (atoi(in_data));
  1493. d351 1
  1494. a351 2
  1495.  
  1496.   return (nchars);
  1497. d364 6
  1498. d371 1
  1499. a371 9
  1500.   if (!prepare_smtp_message (destination))
  1501.     return (0);
  1502.  
  1503.   if (!send_smtp_edit_data (message))
  1504.     return (0);
  1505.  
  1506.   if (!finish_smtp_message ())
  1507.     return (0);
  1508.  
  1509. a376 1
  1510.  
  1511. d378 6
  1512. a383 8
  1513.     return (0);
  1514.  
  1515.   if (!send_smtp_article (Doc))
  1516.     return (0);
  1517.  
  1518.   if (!finish_smtp_message ())
  1519.     return (0);
  1520.  
  1521. a384 1
  1522.   
  1523. d396 2
  1524. d399 1
  1525. a399 1
  1526.   put_smtp_line (SMTPSock, "\r\n", 2);
  1527. @
  1528.  
  1529.  
  1530. 1.4
  1531. log
  1532. @changes for gensock & version 0.91
  1533. @
  1534. text
  1535. @d1 3
  1536. d168 1
  1537. a168 1
  1538.                    (LPSTR)"nntp",
  1539. @
  1540.  
  1541.  
  1542. 1.3
  1543. log
  1544. @multiple recipient stuff, remove gethostname, clean up MAIL FROM: <xxx>
  1545. @
  1546. text
  1547. @d21 3
  1548. a23 1
  1549. void PutCommLine(char *line,unsigned int nchars);
  1550. d64 1
  1551. a64 1
  1552.   char ch;
  1553. d100 4
  1554. d105 1
  1555. a105 1
  1556. PutCommLine (char * line, unsigned int nchars)
  1557. d107 2
  1558. a108 2
  1559.   putline_internal (NNTPSock, line, nchars);
  1560.   putline_internal (NNTPSock, "\n", 1);
  1561. d111 10
  1562. d286 5
  1563. d319 4
  1564. @
  1565.  
  1566.  
  1567. 1.2
  1568. log
  1569. @catch both wait_a_bit and err_busy
  1570. @
  1571. text
  1572. @d201 2
  1573. a202 1
  1574.   /* char my_name[128]; */
  1575. a203 4
  1576.   /* get our hostname */
  1577.   /* leaving this out for now. yuck */
  1578.   /*  gethostname (my_name, 128); */
  1579.  
  1580. a206 1
  1581.   /* sprintf (out_data, "HELO %s\r\n", my_name); */
  1582. d215 1
  1583. a215 1
  1584.   sprintf (out_data, "MAIL From: <%s (%s)>\r\n", MailAddress, UserName);
  1585. d224 23
  1586. a246 2
  1587.   sprintf (out_data, "RCPT To: <%s>\r\n", destination);
  1588.   put_smtp_line (SMTPSock, out_data, strlen (out_data));    
  1589. d248 2
  1590. a249 4
  1591.   if (get_smtp_line() != 250) {
  1592.     smtp_error ("The mail server doesn't like the recipient's name, "
  1593.         "have you set the 'To: ' field correctly?");
  1594.     return (0);
  1595. @
  1596.  
  1597.  
  1598. 1.1
  1599. log
  1600. @Initial revision
  1601. @
  1602. text
  1603. @d66 1
  1604. a66 1
  1605.     if (retval != WAIT_A_BIT) {
  1606. d68 4
  1607. @
  1608.